package cn.szzsi.programmer.interceptor;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;

/**
 * Created by admin on 2017/7/17.
 */
public class ProgrammerInterceptor implements Interceptor {
    @Override
    public void intercept(Invocation ai) {
        Controller c=ai.getController();
        String programmer=c.getCookie("programmer");
        if(programmer==null){
            c.renderHtml("<script>top.location.href='/programmer/login'</script>");
            return;
        }
        ai.invoke();

    }
}
